---@class CanActionCondition:AbstractCondition
local CanActionCondition = ClientFight.CreateClass("CanActionCondition",ClientFight.AbstractCondition)

function CanActionCondition:update()
    if self.weather then
        return EStatus.FAILURE
    end
    if FighterStateEnum.is(self.fighter,FighterStateEnum.CAN_NOT_MOVE) then
        if self.fighter.moveTarget ~= nil or self.fighter.moveDirection ~= 0 or self.fighter.movePosition ~= nil then
            -- 停止移动
            self.fighter.moveTarget = nil
            self.fighter.moveDirection = 0
            self.movePosition = nil
            ReportManager.setMoveEndToJsonString(self.fight, self.fighter, self.fighter.moveAction);
            self.fighter.moveAction = nil
            SkillRoleMgr.savePathFile( "[" .. self.fight.frame .. "][STOP]self.fighter " .. self.fighter.fighterId .. " 停止移动".. getJsonStr(self.fighter.position));
        end
       SkillRoleMgr.savePathFile( "[" .. self.fight.frame .. "][行动判断]" .. self.fighter:print() .. "不可移动，设置移动目标为空");
    end
    --不能移动，不能使用技能，不能普通攻击
    if FighterStateEnum.is(self.fighter,FighterStateEnum.CAN_NOT_MOVE) then
        if self.fighter.totalSign.signs[FighterSignEnum.TAG_1000] then
           SkillRoleMgr.savePathFile("[" .. self.fight.frame .. "][行动判断]" .. self.fighter:print() .. "不能移动，不能使用技能，不能普通攻击");
            return EStatus.FAILURE;
        end
        if FighterStateEnum.is(self.fighter,FighterStateEnum.CAN_NOT_USE_SKILL) and FighterStateEnum.is(self.fighter,FighterStateEnum.CAN_NOT_NORMAL_ATTACK) then
           SkillRoleMgr.savePathFile("[" .. self.fight.frame .. "][行动判断]" .. self.fighter:print() .. "不能移动，不能使用技能，不能普通攻击");
            return EStatus.FAILURE;
        end
    end
    --现在在施放技能动作中
    if self.fighter.usingSkill ~= nil then
       SkillRoleMgr.savePathFile( "[" .. self.fight.frame .. "][行动判断]" .. self.fighter:print() .. "正在释放技能" .. self.fighter.usingSkill.skill.skillBean.f_SkillID);
        return EStatus.FAILURE;
    end
    --死亡中
    if self.fighter:isDie() then
        if self.fighter.moveTarget ~= nil or self.fighter.moveDirection ~= 0 or self.fighter.movePosition ~= nil then
            self.fighter.moveTarget = nil
            self.fighter.moveDirection = 0
            self.fighter.movePosition = nil
            ReportManager.setMoveEndToJsonString(self.fight, self.fighter, self.fighter.moveAction);
            self.fighter.moveAction = nil
            SkillRoleMgr.savePathFile("[" .. self.fight.frame .. "][STOP]self.fighter " .. self.fighter.fighterId .. " 停止移动"+ getJsonStr(self.fighter.position));
        end
       SkillRoleMgr.savePathFile( "[" .. self.fight.frame .. "][行动判断]" ..  self.fighter:print() .. "已经死亡");
        return EStatus.FAILURE;
    end
   SkillRoleMgr.savePathFile( "[" .. self.fight.frame .. "][行动判断]" ..  self.fighter:print() .. "可以行动");
    return EStatus.SUCCESS;
end